package org.example;

import com.esotericsoftware.reflectasm.ConstructorAccess;
import com.esotericsoftware.reflectasm.FieldAccess;
import com.esotericsoftware.reflectasm.MethodAccess;
import com.esotericsoftware.reflectasm.PublicConstructorAccess;

import java.lang.annotation.Annotation;
import java.lang.reflect.Field;

/*
<dependency>
    <groupId>com.esotericsoftware</groupId>
    <artifactId>reflectasm</artifactId>
    <version>1.11.9</version>
</dependency>
*/
public class App2 {
    public static void main(String[] args) {
        //构造器
        Dog dog = PublicConstructorAccess.get(Dog.class).newInstance();
        System.out.println("*******************");
        //方法
        MethodAccess methodAccess = MethodAccess.get(Dog.class);
        String[] methodNames = methodAccess.getMethodNames();
        for (String name : methodNames) {
            System.out.println(name);
        }
        System.out.println("*******************");
        //属性
        FieldAccess fieldAccess = FieldAccess.get(Dog.class);
        Field[] fields = fieldAccess.getFields();
        for (Field field : fields) {
            System.out.println(field.getName());
        }


    }
}